package com.yue.wx.scheduled;

import com.yue.wx.task.WeChatTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author zhengyl
 * @description 定时获取access_token 默认2小时过期
 * @date 2020/8/20 17:25
 */
@Component
public class QuartzJob {

    @Autowired
    private WeChatTask weChatTask;

    //每隔1小时执行一次
    @Scheduled(fixedRate = 6000 * 60 * 60)
    public void testTasks1() throws Exception {
        weChatTask.getToken();
    }
}
